/**
 * Created by 19222 on 2018/4/15.
 */
import java.util.*;
public class pp86lei {
    private Accoun[] zhanghu;
    private int a;
    private double b;

    public pp86lei() {
        zhanghu = new Accoun[30];
        a = 0;
        b = 0;

    }

    public void addAcoun(String name, int numb, double yue) {
        if (a > 30)
            System.out.println("超出账户数目了");
        else {
            zhanghu[a] = new Accoun(name, numb, yue);
            System.out.println("新账户的账号是" + a);
            a++;
        }

    }

    public String getYue(int numb, double yue) {
        if (a < 30 || a >= 0) {
            zhanghu[a].deposit(yue);
            return "余额：" + zhanghu[a].getBalance();
        } else
            return "错误";

    }

    public String putMoney(double 余额, double 进去的钱, int a) {
        if (a < 30 || a >= 0) {
            zhanghu[a].withdraw(余额, 进去的钱);
            return "余额" + zhanghu[a].getBalance();
        } else
            return "错误";
    }

    public String toString() {
        int zhangfu = a + 1;
        String 账单 = "你的账户号码：" + zhanghu + "\n 你的账户余额:";

        for (int index = 0; index <= a; index++) {
            账单 += zhanghu[a].toString() + "\n";
        }
        return 账单;


    }

    public String addInterest() {
        for (int actIndex = 0; actIndex <= b; actIndex++) {
            if (zhanghu[actIndex] != null) {
                zhanghu[actIndex].addInterest();
            } else
                break;
        }
        return "ADDED INTEREST TO EVERY ACCOUNTS!\n";
    }
}


